import {
  q as n,
  ap as ae,
  X as w,
  f as te,
  H as ne,
  av as _,
  aw as se,
  k as u,
  m as B,
  l as S,
  as as o,
  at as U
} from "./index-b50e6ef9.js";
import { s as oe, a as O, b as x } from "./square-934d8760.js";
import { d as ie } from "./goods-bd9f9b53.js";
function ue(V) {
  const g = n([]),
    d = n(!0);
  n({});
  const h = n(1),
    m = n(10),
    C = n({}),
    f = n([]),
    c = n(),
    v = n(1),
    J = n(""),
    W = n([]),
    k = n(""),
    D = n(""),
    z = n(""),
    y = n(10),
    L = ae("reload"),
    b = w({
      pageSize: 10,
      currentPage: 1,
      pageSizes: [10, 20, 30],
      total: 0,
      align: "right",
      background: !0,
      small: !1
    }),
    p = w({
      pageSize: 10,
      currentPage: 1,
      pageSizes: [5, 10, 20],
      total: 0,
      align: "right",
      background: !0,
      small: !1
    }),
    A = w({
      text: "正在加载第一页...",
      viewBox: "-10, -10, 50, 50",
      spinner: `
        <path class="path" d="
          M 30 15
          L 28 17
          M 25.61 25.61
          A 15 15, 0, 0, 1, 15 30
          A 15 15, 0, 1, 1, 27.99 7.5
          L 15 15
        " style="stroke-width: 4px; fill: rgba(0, 0, 0, 0)"/>
      `
    }),
    R = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      { label: "ID", prop: "id", minWidth: 50 },
      {
        label: "用户",
        prop: "user_name",
        minWidth: 100,
        formatter: ({ user_name: e, user_phone: a }) =>
          u("div", null, [u("div", null, [e]), u("div", null, [a])])
      },
      { label: "标签", prop: "tags", minWidth: 200, slot: "tagOperation" },
      { label: "云值", prop: "value", minWidth: 80 },
      {
        label: "状态",
        prop: "status",
        minWidth: 100,
        formatter: ({ status: e }) => {
          if (e == 1)
            return u(
              S("el-tag"),
              { type: "warning", size: "mini" },
              { default: () => [B("待审核")] }
            );
          if (e == 2)
            return u(
              S("el-tag"),
              { type: "success", size: "mini" },
              { default: () => [B("已通过")] }
            );
          if (e == 3)
            return u(
              S("el-tag"),
              { type: "danger", size: "mini" },
              { default: () => [B("已驳回")] }
            );
        }
      },
      { label: "创建时间", minWidth: 180, prop: "create_time" },
      { label: "操作", fixed: "right", width: 240, slot: "operation" }
    ],
    T = [
      {
        type: "selection",
        width: 55,
        align: "left",
        hide: ({ checkList: e }) => !e.includes("勾选列")
      },
      {
        label: "序号",
        type: "index",
        width: 70,
        hide: ({ checkList: e }) => !e.includes("序号列")
      },
      { label: "ID", prop: "id", fixed: "left", minWidth: 60 },
      { label: "帖子ID", prop: "square_id", fixed: "left", minWidth: 60 },
      { label: "姓名", prop: "user_name", minWidth: 150 },
      { label: "手机号", prop: "user_phone", minWidth: 120 },
      { label: "云值", prop: "value", minWidth: 120 },
      { label: "创建时间", minWidth: 180, prop: "create_time" }
    ],
    q = te(() => [
      "!h-[20px]",
      "reset-margin",
      "!text-gray-500",
      "dark:!text-white",
      "dark:hover:!text-primary"
    ]);
  async function M(e) {
    const a = { wares_id: e.wares_id },
      s = JSON.stringify(a),
      i = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(s)) },
      t = await ie(i);
    t.code == 200
      ? (U("删除成功", { type: "success" }), L())
      : U(t.msg, { type: "error" });
  }
  function H() {}
  function P(e) {
    (m.value = e), I(void 0, e);
  }
  function j(e) {
    (h.value = e), I(e, void 0);
  }
  function X(e) {
    (v.value = e), N(e, void 0);
  }
  function Y(e) {
    (y.value = e), N(void 0, e);
  }
  function $(e) {}
  async function E(e) {
    const a = { id: e.id },
      s = JSON.stringify(a),
      i = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(s)) },
      t = await oe(i);
    t.code == 200 && (C.value = t.data);
  }
  function G(e) {
    (A.text = `正在加载第${e}页...`),
      (d.value = !0),
      _(600).then(() => {
        d.value = !1;
      });
  }
  async function K(e, a, s) {
    (d.value = !0), (k.value = e), (D.value = a), (z.value = s);
    const l = {
        page: h.value,
        pagesize: m.value,
        id: c.value,
        user_phone: isNaN(e) ? void 0 : e,
        status: a,
        tag: s
      },
      i = JSON.stringify(l),
      r = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(i)) },
      { data: F } = await O(r);
    (g.value = F.data.data),
      (b.total = F.data.total),
      setTimeout(() => {
        d.value = !1;
      }, 500);
  }
  async function Q(e) {
    d.value = !0;
    const a = { user_phone: isNaN(e) ? void 0 : e, id: c.value },
      s = JSON.stringify(a),
      i = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(s)) },
      { data: t } = await x(i);
    (p.total = t.total),
      (f.value = t.data),
      setTimeout(() => {
        d.value = !1;
      }, 500);
  }
  async function I(e = h.value, a = m.value) {
    const s = { page: e, pagesize: a, status: D.value, tag: z.value },
      l = JSON.stringify(s),
      t = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(l)) },
      r = await O(t);
    r.code === 200
      ? ((W.value = r.data.tag),
        (g.value = r.data.data.data),
        (b.total = r.data.data.total),
        setTimeout(() => {
          d.value = !1;
        }, 500))
      : U(r.msg, { type: "error" });
  }
  const N = async (e = v.value, a = y.value) => {
      const s = { page: e, pagesize: a, id: c.value },
        l = JSON.stringify(s),
        t = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(l)) },
        r = await x(t);
      r.code === 200 && ((p.total = r.data.total), (f.value = r.data.data));
    },
    Z = e => {
      e && (e.resetFields(), location.reload());
    },
    ee = async e => {
      if (!e) return;
      e.resetFields();
      const a = { id: c.value },
        s = JSON.stringify(a),
        i = { value: o.enc.Base64.stringify(o.enc.Utf8.parse(s)) },
        t = await x(i);
      (J.value = ""), (p.total = t.data.total), (f.value = t.data.data);
    };
  return (
    ne(() => {
      _().then(() => {
        const { setWatermark: e } = se(V.value.getTableDoms().tableWrapper);
        e("后台项目", {
          font: "16px Microsoft YaHei",
          globalAlpha: 0.8,
          forever: !0,
          width: 252,
          height: 80
        });
      }),
        I();
    }),
    {
      loading: d,
      columns: R,
      dataList: g,
      pagination: b,
      buttonClass: q,
      orderInfo: C,
      userInfo: f,
      columsUser: T,
      paginationUser: p,
      meetingId: c,
      userPhone: J,
      countUser: v,
      pageCountUser: y,
      tagsList: W,
      handleUserCurrentChange: X,
      handleUserSizeChange: Y,
      handleLookUserDatil: E,
      onSearchUser: Q,
      onSearch: K,
      resetForm: Z,
      handleaddUser: H,
      handleDelete: M,
      handleSizeChange: P,
      handleCurrentChange: j,
      handleSelectionChange: $,
      onCurrentChange: G,
      resetFormUser: ee
    }
  );
}
export { ue as useRole };
